import React from "react";

import GraphicImage from "./image/graphic-image";

import Label from "./label/label";

/**
 * 组件列表
 * 1.image
 * 2.text
 */
const componentList = (obj) => {
  if (obj.type === 1) {
    return (
      <Label
        id={obj.id}
        key={obj.id}
        type={obj.type}
        drag={obj.drag}
        box={obj.box}
        graphicId={obj.graphicId}
        width={obj.width}
        height={obj.height}
        editable={obj.editable}
        point={obj.point}
        text={obj.text}
        pointValue={obj.pointValue}
        top={obj.top}
        left={obj.left}
        componentTypeId={obj.componentTypeId}
      />
    );
  }
  return (
    <GraphicImage
      id={obj.id}
      key={obj.id}
      drag={obj.drag}
      type={obj.type}
      graphicId={obj.graphicId}
      path={obj.path}
      box={obj.box}
      point={obj.point}
      text={obj.text}
      width={obj.width}
      height={obj.height}
      editable={obj.editable}
      top={obj.top}
      left={obj.left}
      flag={obj.flag}
      componentTypeId={obj.componentTypeId}
    />
  );
};

export default {
  componentList: componentList,
};
